<template>
  <div id="app">
    <div v-wechat-title="$route.meta.title"></div>
    <router-view></router-view>
  </div>
</template>

<script>
import { wxlocation } from "@/config/wxLocation"
export default {
  name: 'app',
  data () {
    return{}
  },
  created () {
    this.uid = this.$route.query.uid;
    this.getUID();
    // sessionStorage.setItem('uid', 44)
  },
  watch: {
    "$route"(to, from) {
      this.getUID();      
    }
  },
  methods: {
    // 判断是否已认证登录获取uid
    getUID() {
      if(this.uid || sessionStorage.getItem('uid')){
        if(sessionStorage.getItem('uid')){
          return;
        }  
        sessionStorage.setItem('uid', this.uid)
      }else{
        let str = '';
        if(this.$route.query.pid){
          str = "?pid="+this.$route.query.pid;
        }
        window.location.href = 'http://rytest.wawa89.net/index.php/Home/Index/wxLogin'+str;
      }
    },
  }
}
</script>

<style>
</style>
